/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.openbrew.openbrewrf;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author chapmand
 */
@Entity
@Table(name = "DocData")
@XmlRootElement
public class DocData {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ddID")
    private Integer ddid;
    @Basic(optional = false)
    @NotNull
    @Lob
    @Column(name = "document")
    private byte[] doc;
    
    public DocData() {
    }

    public DocData(Integer ddid) {
        this.ddid = ddid;
    }
    
    public DocData(Integer ddid, byte[] doc) {
        this.ddid = ddid;
        this.doc = doc;
    }

    public Integer getId() {
        return ddid;
    }

    public void setId(Integer ddid) {
        this.ddid = ddid;
    }

    public byte[] getDoc() {
        return doc;
    }

    public void setDoc(byte[] doc) {
        this.doc = doc;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ddid != null ? ddid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Beer)) {
            return false;
        }
        DocData other = (DocData) object;
        if ((this.ddid == null && other.ddid != null) || (this.ddid != null && !this.ddid.equals(other.ddid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.openbrew.openbrewrf.DocData[ docID=" + ddid + " ]";
    }
    
}
